<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css"> /* pertinent to test cases */
.quote:before { content: "*"; }
.quote:after { content: "*"; }

.bidi:before { content: "aפb"; }
.bidi:after { content: "aפb"; }
</style>
<script src="../../../resources/js-test.js"></script>
<title></title>
</head>
<body>
<p>This webpage should not hang when we try to move beyond the quotes.</p>

<div contenteditable="true" id="test1">
<span class="quote">content</span>
</div>

<div contenteditable="true" id="test2">
a<span class="quote">content</span>a
</div>

<div contenteditable="true" id="test3">
<span class="bidi">content</span>
</div>

<div contenteditable="true" id="test4">
a<span class="bidi">content</span>a
</div>

<div id="console"></div>
<script>

var edit = document.getElementById('test1');
edit.focus();

for (var i = 0; i < 9; ++i) 
    window.getSelection().modify('move', 'right', 'character');

for (var i = 0; i < 9; ++i)
    window.getSelection().modify('move', 'left', 'character');

var edit = document.getElementById('test2');
edit.focus();

for (var i = 0; i < 11; ++i)
    window.getSelection().modify('move', 'right', 'character');

for (var i = 0; i < 11; ++i)
    window.getSelection().modify('move', 'left', 'character');

var edit = document.getElementById('test3');
edit.focus();

for (var i = 0; i < 9; ++i) 
    window.getSelection().modify('move', 'right', 'character');

for (var i = 0; i < 9; ++i)
    window.getSelection().modify('move', 'left', 'character');

var edit = document.getElementById('test4');
edit.focus();

for (var i = 0; i < 11; ++i)
    window.getSelection().modify('move', 'right', 'character');

for (var i = 0; i < 11; ++i)
    window.getSelection().modify('move', 'left', 'character');


</script>
</body>
</html>
